home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_com_fists.cog < prev    next >
Text File  |  1999-11-15  |  3KB  |  145 lines

  1. # Jones 3D Cog Script
  2. #
  3. # com_Fists.cog
  4. #
  5. # This COG controls fists for bad guys.
  6. #
  7. # [RandyT]
  8. #
  9. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  10. #
  11. # ===================================================================
  12.  
  13. symbols
  14.  
  15. message        fire
  16. message        activated
  17. message        deactivated
  18. message        selected
  19. message        deselected
  20.  
  21. template    projectile=+fists            local            
  22.  
  23. thing        bandito                        local
  24.  
  25. flex        fireWait                    local
  26.  
  27. int            numFires=0                    local
  28. int            nextFist=0                    local
  29. int            pupMode                        local
  30.  
  31. end
  32.  
  33. # ===================================================================
  34. code
  35.  
  36. # -------------------------------------------------------------------
  37. fire:
  38.  
  39.     bandito = GetSourceRef();
  40.  
  41.     # If he's done firing, deactivate the weapon
  42.     numFires = GetThingUserData(bandito);
  43.     if (numFires == 0)
  44.     {
  45.         DeactivateCurWeapon(bandito);
  46.         return;
  47.     }
  48.  
  49.     # If the message is from the weapons system, pick animation
  50.     if (GetParam(0) != -1)
  51.     {
  52.         # Select-o-punch
  53.         if (nextFist == 0)
  54.         {
  55.             if (Rand() < 0.5)
  56.             {
  57.                 pupMode = 65;
  58.                 fireWait = 0.57; 
  59.             
  60.             } else {
  61.                 
  62.                 pupMode = 66;
  63.                 fireWait = 0.5; 
  64.             }
  65.  
  66.         } else {
  67.  
  68.             if (Rand() < 0.5)
  69.             {
  70.                 pupMode = 67;
  71.                 fireWait = 0.7; 
  72.             
  73.             } else {
  74.                 
  75.                 pupMode = 68;
  76.                 fireWait = 0.7; 
  77.             }
  78.         }
  79.  
  80.         nextFist = 1 - nextFist;
  81.  
  82.         SetFireWait(bandito, fireWait);
  83.         PlayMode(bandito, pupMode, 0);
  84.  
  85.         return;
  86.     }
  87.  
  88.     # Actual firing takes place when we get the callback...
  89.     FireProjectile(bandito, projectile, -1, -1, GetThingPos(bandito), '0 0 0', 1.0, 0x0, 0.0, 0.0);
  90.  
  91.     # Set the number of shots left
  92.     numFires = numFires - 1;
  93.     SetThingUserData(bandito, numFires);
  94.  
  95.     return;
  96.  
  97.  
  98. # -------------------------------------------------------------------
  99. activated:
  100.  
  101.     bandito = GetSourceRef();
  102.     
  103.     SetThingUserData(bandito, GetParam(0)); 
  104.     ActivateWeapon(bandito, 0.5);
  105.  
  106.     return;
  107.  
  108.  
  109. # -------------------------------------------------------------------
  110. deactivated:
  111.  
  112.     bandito = GetSourceRef();
  113.  
  114.     SetThingUserData(bandito, 0); 
  115.     DeactivateWeapon(bandito);
  116.  
  117.     return;
  118.  
  119.  
  120. # -------------------------------------------------------------------
  121. selected:
  122.  
  123.     bandito = GetSourceRef();
  124.  
  125.     SetThingFireOffset(bandito, '0.0 0.0 0.0');
  126.     SetArmedMode(bandito, 0);
  127.     PlayMode(bandito, 62, 0);
  128.  
  129.     SetAimWait(bandito, 0.5);
  130.  
  131.     return;
  132.  
  133.  
  134. # -------------------------------------------------------------------
  135. deselected:
  136.  
  137.     bandito = GetSourceRef();
  138.  
  139.     StopMode(bandito, 62, 0);
  140.     SetThingFireOffset(bandito, '0 0 0');
  141.  
  142.     return;
  143.  
  144. end
  145.